home *** CD-ROM | disk | FTP | other *** search
/ Amiga Tools 2 / Amiga Tools 2.iso / grafik / triton / demos / demo / demo.c < prev    next >
C/C++ Source or Header  |  1994-04-09  |  38KB  |  1,161 lines

  1. /*
  2.  *  Triton - The object oriented GUI creation system for the Amiga
  3.  *  Written by Stefan Zeiger in 1993-1994
  4.  *
  5.  *  (c) 1993-1994 by Stefan Zeiger
  6.  *  You are hereby allowed to use this source or parts of it for
  7.  *  creating programs for AmigaOS which use the Triton GUI creation
  8.  *  system. All other rights reserved.
  9.  *
  10.  *  demo.c - Triton demo program
  11.  *
  12.  */
  13.  
  14.  
  15. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  16. //////////////////////////////////////////////////////////////////////////////////////// Include our stuff //
  17. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  18.  
  19. #include <libraries/triton.h>
  20. #include <proto/triton.h>
  21. #include <proto/dos.h>
  22. #include <stdio.h>
  23. #include <stdlib.h>
  24. #include <string.h>
  25.  
  26.  
  27. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  28. ///////////////////////////////////////////////////////////////////////////////////////// Global variables //
  29. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  30.  
  31. struct TR_Project *main_project;
  32.  
  33.  
  34. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  35. ////////////////////////////////////////////////////////////////////////////////////////// Window 'groups' //
  36. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  37.  
  38. ProjectDefinition(groups_trwintags)
  39. {
  40.   WindowTitle("Groups"), WindowPosition(TRWP_CENTERDISPLAY), WindowUnderscore("~"), WindowID(1),
  41.  
  42.   VertGroupA,
  43.     Space,
  44.     NamedSeparator("TRGR_PROPSHARE (default)"),
  45.     Space,
  46.  
  47.     HorizGroupC,
  48.       Space,
  49.       Button("Short",1),
  50.       Space,
  51.       Button("And much, much longer...",2),
  52.       Space,
  53.       EndGroup,
  54.  
  55.     Space,
  56.     NamedSeparator("TRGR_EQUALSHARE"),
  57.     Space,
  58.  
  59.     HorizGroupEC,
  60.       Space,
  61.       Button("Short",3),
  62.       Space,
  63.       Button("And much, much longer...",4),
  64.       Space,
  65.       EndGroup,
  66.  
  67.     Space,
  68.     NamedSeparator("TRGR_PROPSPACES"),
  69.     Space,
  70.  
  71.     HorizGroupSC,
  72.       Space,
  73.       Button("Short",5),
  74.       Space,
  75.       Button("And much, much longer...",6),
  76.       Space,
  77.       EndGroup,
  78.  
  79.     Space,
  80.     NamedSeparator("TRGR_ARRAY"),
  81.     Space,
  82.  
  83.     LineArray,
  84.       BeginLine,
  85.         Space,
  86.         Button("Short",7),
  87.         Space,
  88.         Button("And much, much longer...",8),
  89.         Space,
  90.         EndLine,
  91.       Space,
  92.       BeginLine,
  93.         Space,
  94.         Button("Not so short",9),
  95.         Space,
  96.         Button("And a bit longer...",10),
  97.         Space,
  98.         EndLine,
  99.       Space,
  100.       BeginLine,
  101.         Space,
  102.         Button("foo bar",12),
  103.         Space,
  104.         Button("42",13),
  105.         Space,
  106.         EndLine,
  107.       EndArray,
  108.  
  109.     Space,
  110.     EndGroup,
  111.   EndProject
  112. };
  113.  
  114.  
  115. VOID do_groups(VOID)
  116. {
  117.   BOOL close_me=FALSE;
  118.   struct TR_Message *trmsg;
  119.   struct TR_Project *groups_project;
  120.  
  121.   if(groups_project=TR_OpenProject(Application,groups_trwintags))
  122.   {
  123.     TR_LockProject(main_project);
  124.     while(!close_me)
  125.     {
  126.       TR_Wait(Application,NULL);
  127.       while(trmsg=TR_GetMsg(Application))
  128.       {
  129.         if(trmsg->trm_Project==groups_project) switch(trmsg->trm_Class)
  130.         {
  131.           case TRMS_CLOSEWINDOW:
  132.             close_me=TRUE;
  133.             break;
  134.  
  135.           case TRMS_ERROR:
  136.             puts(TR_GetErrorString(trmsg->trm_Data));
  137.             break;
  138.         }
  139.         TR_ReplyMsg(trmsg);
  140.       }
  141.     }
  142.     TR_UnlockProject(main_project);
  143.     TR_CloseProject(groups_project);
  144.   }
  145. }
  146.  
  147.  
  148. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  149. /////////////////////////////////////////////////////////////////////////////////////////// Window 'menus' //
  150. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  151.  
  152. struct TagItem menus_trwintags[]=
  153. {
  154.   WindowID(2), WindowTitle("Menus"),
  155.  
  156.   TRMN_Title,                 (ULONG) "A menu",
  157.    TRMN_Item,                 (ULONG) "A simple item", TRAT_ID, 1,
  158.    TRMN_Item,                 (ULONG) "Another item", TRAT_ID, 2,
  159.    TRMN_Item,                 (ULONG) "And now... a barlabel", TRAT_ID, 3,
  160.    TRMN_Item,                 (ULONG) TRMN_BARLABEL,
  161.    TRMN_Item,                 (ULONG) "1_An item with a shortcut", TRAT_ID, 4,
  162.    TRMN_Item,                 (ULONG) "2_Another one", TRAT_ID, 5,
  163.    TRMN_Item,                 (ULONG) "3_And number 3", TRAT_ID, 6,
  164.    TRMN_Item,                 (ULONG) TRMN_BARLABEL,
  165.    TRMN_Item,                 (ULONG) "_F1_And under OS3.0: Extended command keys", TRAT_ID, 6,
  166.    TRMN_Item,                 (ULONG) "_F2_Another one", TRAT_ID, 7,
  167.    TRMN_Item,                 (ULONG) TRMN_BARLABEL,
  168.    TRMN_Item,                 (ULONG) "How do you like submenus?",
  169.     TRMN_Sub,                 (ULONG) "G_Great!", TRAT_ID, 8,
  170.     TRMN_Sub,                 (ULONG) "F_Fine", TRAT_ID, 9,
  171.     TRMN_Sub,                 (ULONG) "D_Don't know", TRAT_ID, 10,
  172.     TRMN_Sub,                 (ULONG) "N_Not so fine", TRAT_ID, 11,
  173.     TRMN_Sub,                 (ULONG) "P_Puke!", TRAT_ID, 12,
  174.  
  175.   TRMN_Title,                 (ULONG) "Another menu",
  176.    TRMN_Item,                 (ULONG) "This item is ghosted", TRMN_Flags, TRMF_DISABLED, TRAT_ID, 100,
  177.    TRMN_Item,                 (ULONG) TRMN_BARLABEL,
  178.    TRMN_Item,                 (ULONG) "Item 1 is checked", TRMN_Flags, TRMF_CHECKED, TRAT_ID, 13,
  179.    TRMN_Item,                 (ULONG) "Item 2 can be checked, too", TRMN_Flags, TRMF_CHECKIT, TRAT_ID, 14,
  180.  
  181.   TRMN_Title,                 (ULONG) "Ghosted menu",
  182.   TRMN_Flags,                 (ULONG) TRMF_DISABLED,
  183.    TRMN_Item,                 (ULONG) "Item 1", TRAT_ID, 101,
  184.    TRMN_Item,                 (ULONG) "Item 2", TRAT_ID, 102,
  185.  
  186.   TAG_END
  187. };
  188.  
  189.  
  190. VOID do_menus(VOID)
  191. {
  192.   BOOL close_me=FALSE;
  193.   struct TR_Message *trmsg;
  194.   struct TR_Project *menus_project;
  195.  
  196.   if(menus_project=TR_OpenProject(Application,menus_trwintags))
  197.   {
  198.     TR_LockProject(main_project);
  199.     while(!close_me)
  200.     {
  201.       TR_Wait(Application,NULL);
  202.       while(trmsg=TR_GetMsg(Application))
  203.       {
  204.         if(trmsg->trm_Project==menus_project) switch(trmsg->trm_Class)
  205.         {
  206.           case TRMS_CLOSEWINDOW:
  207.             close_me=TRUE;
  208.             break;
  209.  
  210.           case TRMS_ERROR:
  211.             puts(TR_GetErrorString(trmsg->trm_Data));
  212.             break;
  213.  
  214.           case TRMS_NEWVALUE:
  215.             printf("The new value of object %d is %d.\n",trmsg->trm_ID,trmsg->trm_Data);
  216.             break;
  217.  
  218.           case TRMS_ACTION:
  219.             printf("Object %d has triggered an action.\n",trmsg->trm_ID);
  220.             break;
  221.         }
  222.         TR_ReplyMsg(trmsg);
  223.       } 
  224.     }
  225.     TR_UnlockProject(main_project);
  226.     TR_CloseProject(menus_project);
  227.   }
  228. }
  229.  
  230.  
  231. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  232. ///////////////////////////////////////////////////////////////////////////////////////// Window 'gadgets' //
  233. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  234.  
  235. STRPTR cycle_entries[]=
  236. {
  237.   "Entry 0",
  238.   "1",
  239.   "2",
  240.   "3",
  241.   "4",
  242.   "5",
  243.   "6",
  244.   "7",
  245.   "8",
  246.   "9",
  247.   NULL
  248. };
  249.  
  250.  
  251. struct TagItem gadgets_trwintags[]=
  252. {
  253.   WindowID(3),
  254.   WindowTitle("Gadgets"),
  255.   WindowPosition(TRWP_CENTERDISPLAY),
  256.  
  257.   TRGR_Vert,                  (ULONG) TRGR_PROPSHARE|TRGR_ALIGN,
  258.  
  259.     TROB_Space,               (ULONG) NULL,
  260.  
  261.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_CENTER,
  262.       TROB_Space,             (ULONG) NULL,
  263.       TROB_Line,              (ULONG) TROF_HORIZ,
  264.       TROB_Space,             (ULONG) NULL,
  265.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "GadTools", TRAT_Flags, (ULONG) TRTX_3D,
  266.       TROB_Space,             (ULONG) NULL,
  267.       TROB_Line,              (ULONG) TROF_HORIZ,
  268.       TROB_Space,             (ULONG) NULL,
  269.     TRGR_End,                 (ULONG) NULL,
  270.  
  271.     TROB_Space,               (ULONG) NULL,
  272.  
  273.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  274.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  275.         TROB_Space,           (ULONG) NULL,
  276.         TROB_CheckBox,        (ULONG) NULL,
  277.           TRAT_ID,            (ULONG) 1,
  278.           TRAT_Value,         (ULONG) TRUE,
  279.       TRGR_End,               (ULONG) NULL,
  280.       TROB_Space,             (ULONG) NULL,
  281.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  282.         TROB_Text,            (ULONG) NULL,
  283.           TRAT_Text,          (ULONG) "_Checkbox",
  284.           TRAT_ID,            (ULONG) 1,
  285.       TROB_Space,             (ULONG) NULL,
  286.       TRGR_End,               (ULONG) NULL,
  287.     TRGR_End,                 (ULONG) NULL,
  288.  
  289.     TROB_Space,               (ULONG) NULL,
  290.  
  291.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  292.       TRGR_Horiz,             (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  293.         TROB_Space,           (ULONG) NULL,
  294.         TROB_Slider,          (ULONG) NULL,
  295.           TRAT_ID,            (ULONG) 4,
  296.           TRSL_Min,           (ULONG) 1,
  297.           TRSL_Max,           (ULONG) 3,
  298.           TRAT_Value,         (ULONG) 1,
  299.       TRGR_End,               (ULONG) NULL,
  300.       TROB_Space,             (ULONG) NULL,
  301.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  302.         TROB_Text,            (ULONG) NULL,
  303.           TRAT_Text,          (ULONG) "_Slider: ",
  304.           TRAT_ID,            (ULONG) 4,
  305.         TROB_Text,            (ULONG) NULL,
  306.           TRAT_Value,         (ULONG) 1,
  307.           TRAT_ID,            (ULONG) 4,
  308.           TRAT_MinWidth,      (ULONG) 3,
  309.       TROB_Space,             (ULONG) NULL,
  310.       TRGR_End,               (ULONG) NULL,
  311.     TRGR_End,                 (ULONG) NULL,
  312.  
  313.     TROB_Space,               (ULONG) NULL,
  314.  
  315.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  316.       TRGR_Horiz,             (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  317.         TROB_Space,           (ULONG) NULL,
  318.         TROB_Scroller,        (ULONG) NULL,
  319.           TRAT_ID,            (ULONG) 5,
  320.           TRAT_Value,         (ULONG) 2,
  321.           TRSC_Total,         (ULONG) 7,
  322.           TRSC_Visible,       (ULONG) 3,
  323.       TRGR_End,               (ULONG) NULL,
  324.       TROB_Space,             (ULONG) NULL,
  325.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  326.         TROB_Text,            (ULONG) NULL,
  327.           TRAT_Text,          (ULONG) "Sc_roller: ",
  328.           TRAT_ID,            (ULONG) 5,
  329.         TROB_Text,            (ULONG) NULL,
  330.           TRAT_Value,         (ULONG) 2,
  331.           TRAT_ID,            (ULONG) 5,
  332.           TRAT_MinWidth,      (ULONG) 3,
  333.       TROB_Space,             (ULONG) NULL,
  334.       TRGR_End,               (ULONG) NULL,
  335.     TRGR_End,                 (ULONG) NULL,
  336.  
  337.     TROB_Space,               (ULONG) NULL,
  338.  
  339.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  340.       TRGR_Horiz,             (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  341.         TROB_Space,           (ULONG) NULL,
  342.         TROB_Palette,         (ULONG) NULL,
  343.           TRAT_ID,            (ULONG) 3,
  344.           TRAT_Value,         (ULONG) 1,
  345.       TRGR_End,               (ULONG) NULL,
  346.       TROB_Space,             (ULONG) NULL,
  347.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  348.         TROB_Text,            (ULONG) NULL,
  349.           TRAT_Text,          (ULONG) "_Palette: ",
  350.           TRAT_ID,            (ULONG) 3,
  351.         TROB_Text,            (ULONG) NULL,
  352.           TRAT_Value,         (ULONG) 1,
  353.           TRAT_ID,            (ULONG) 3,
  354.           TRAT_MinWidth,      (ULONG) 3,
  355.       TROB_Space,             (ULONG) NULL,
  356.       TRGR_End,               (ULONG) NULL,
  357.     TRGR_End,                 (ULONG) NULL,
  358.  
  359.     TROB_Space,               (ULONG) NULL,
  360.  
  361.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  362.       TRGR_Horiz,             (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  363.         TROB_Space,           (ULONG) NULL,
  364.         TROB_Cycle,           (ULONG) cycle_entries,
  365.           TRAT_ID,            (ULONG) 6,
  366.           TRAT_Value,         (ULONG) 4,
  367.       TRGR_End,               (ULONG) NULL,
  368.       TROB_Space,             (ULONG) NULL,
  369.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  370.         TROB_Text,            (ULONG) NULL,
  371.           TRAT_Text,          (ULONG) "C_ycle: ",
  372.           TRAT_ID,            (ULONG) 6,
  373.         TROB_Text,            (ULONG) NULL,
  374.           TRAT_Value,         (ULONG) 4,
  375.           TRAT_ID,            (ULONG) 6,
  376.           TRAT_MinWidth,      (ULONG) 3,
  377.       TROB_Space,             (ULONG) NULL,
  378.       TRGR_End,               (ULONG) NULL,
  379.     TRGR_End,                 (ULONG) NULL,
  380.  
  381.     TROB_Space,               (ULONG) NULL,
  382.  
  383.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_ALIGN|TRGR_CENTER,
  384.       TRGR_Horiz,             (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  385.         TROB_Space,           (ULONG) NULL,
  386.         TROB_String,          (ULONG) "foo bar",
  387.           TRAT_ID,            (ULONG) 7,
  388.       TRGR_End,               (ULONG) NULL,
  389.       TROB_Space,             (ULONG) NULL,
  390.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  391.         TROB_Text,            (ULONG) NULL,
  392.           TRAT_Text,          (ULONG) "S_tring",
  393.           TRAT_ID,            (ULONG) 7,
  394.       TROB_Space,             (ULONG) NULL,
  395.       TRGR_End,               (ULONG) NULL,
  396.     TRGR_End,                 (ULONG) NULL,
  397.  
  398.     TROB_Space,               (ULONG) NULL,
  399.  
  400.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_CENTER,
  401.       TROB_Space,             (ULONG) NULL,
  402.       TROB_Line,              (ULONG) TROF_HORIZ,
  403.       TROB_Space,             (ULONG) NULL,
  404.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "BOOPSI", TRAT_Flags, (ULONG) TRTX_3D,
  405.       TROB_Space,             (ULONG) NULL,
  406.       TROB_Line,              (ULONG) TROF_HORIZ,
  407.       TROB_Space,             (ULONG) NULL,
  408.     TRGR_End,                 (ULONG) NULL,
  409.  
  410.     TROB_Space,               (ULONG) NULL,
  411.  
  412.     TRGR_Horiz,               (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  413.       TROB_Space,             (ULONG) NULL,
  414.       TROB_Button,            (ULONG) NULL, TRAT_ID, 2, TRAT_Text, (ULONG) "_Button",
  415.       TROB_Space,             (ULONG) NULL,
  416.     TRGR_End,                 (ULONG) NULL,
  417.  
  418.     TROB_Space,               (ULONG) NULL,
  419.  
  420.     TRGR_Horiz,               (ULONG) TRGR_PROPSPACES|TRGR_ALIGN|TRGR_CENTER,
  421.       TROB_Space,             (ULONG) NULL,
  422.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "_File:", TRAT_ID, 10,
  423.       TROB_Space,             (ULONG) NULL,
  424.       TROB_Button,            (ULONG) TRBT_GETFILE, TRAT_ID, 10, TRAT_Text, (ULONG) "",
  425.       TROB_Space,             (ULONG) NULL,
  426.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "_Drawer:", TRAT_ID, 11,
  427.       TROB_Space,             (ULONG) NULL,
  428.       TROB_Button,            (ULONG) TRBT_GETDRAWER, TRAT_ID, 11, TRAT_Text, (ULONG) "",
  429.       TROB_Space,             (ULONG) NULL,
  430.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "_Entry:", TRAT_ID, 12,
  431.       TROB_Space,             (ULONG) NULL,
  432.       TROB_Button,            (ULONG) TRBT_GETENTRY, TRAT_ID, 12, TRAT_Text, (ULONG) "",
  433.       TROB_Space,             (ULONG) NULL,
  434.     TRGR_End,                 (ULONG) NULL,
  435.  
  436.     TROB_Space,               (ULONG) NULL,
  437.  
  438.     TRGR_End,                 (ULONG) NULL,
  439.  
  440.   TAG_END
  441. };
  442.  
  443.  
  444. VOID do_gadgets(VOID)
  445. {
  446.   BOOL close_me=FALSE;
  447.   struct TR_Message *trmsg;
  448.   struct TR_Project *gadgets_project;
  449.  
  450.   if(gadgets_project=TR_OpenProject(Application,gadgets_trwintags))
  451.   {
  452.     TR_LockProject(main_project);
  453.     while(!close_me)
  454.     {
  455.       TR_Wait(Application,NULL);
  456.       while(trmsg=TR_GetMsg(Application))
  457.       {
  458.         if(trmsg->trm_Project==gadgets_project) switch(trmsg->trm_Class)
  459.         {
  460.           case TRMS_CLOSEWINDOW:
  461.             close_me=TRUE;
  462.             break;
  463.  
  464.           case TRMS_ERROR:
  465.             puts(TR_GetErrorString(trmsg->trm_Data));
  466.             break;
  467.         }
  468.         TR_ReplyMsg(trmsg);
  469.       }
  470.     }
  471.     TR_UnlockProject(main_project);
  472.     TR_CloseProject(gadgets_project);
  473.   }
  474. }
  475.  
  476.  
  477. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  478. /////////////////////////////////////////////////////////////////////////////////////// Window 'disabling' //
  479. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  480.  
  481. struct TagItem disabling_trwintags[]=
  482. {
  483.   WindowID(4), WindowTitle("Disabling"), WindowPosition(TRWP_CENTERDISPLAY),
  484.  
  485.   TRGR_Vert,                  (ULONG) TRGR_PROPSHARE|TRGR_ALIGN,
  486.  
  487.     TROB_Space,               (ULONG) NULL,
  488.  
  489.     TRGR_Horiz,               (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  490.       TROB_Space,             (ULONG) NULL,
  491.       TROB_CheckBox,          (ULONG) NULL, TRAT_ID, 1, TRAT_Value, TRUE,
  492.       TROB_Space,             (ULONG) NULL,
  493.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "_Disable", TRAT_ID, 1,
  494.       TRGR_Horiz,             (ULONG) TRGR_PROPSPACES,
  495.         TROB_Space,           (ULONG) NULL,
  496.         TRGR_End,             (ULONG) NULL,
  497.       TRGR_End,               (ULONG) NULL,
  498.  
  499.     TROB_Space,               (ULONG) NULL,
  500.  
  501.     TRGR_Horiz,               (ULONG) TRGR_EQUALSHARE|TRGR_CENTER,
  502.       TROB_Space,             (ULONG) NULL,
  503.       TROB_Line,              (ULONG) TROF_HORIZ,
  504.       TROB_Space,             (ULONG) NULL,
  505.       TRGR_End,               (ULONG) NULL,
  506.  
  507.     TROB_Space,               (ULONG) NULL,
  508.  
  509.     TRGR_Horiz,               (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  510.       TROB_Space,             (ULONG) NULL,
  511.       TROB_CheckBox,          (ULONG) NULL, TRAT_Value, TRUE, TRAT_ID, 2, TRAT_Disabled, TRUE,
  512.       TROB_Space,             (ULONG) NULL,
  513.       TROB_Text,              (ULONG) NULL, TRAT_Text, (ULONG) "_Checkbox", TRAT_ID, 2,
  514.       TROB_Space,             (ULONG) NULL,
  515.     TRGR_End,                 (ULONG) NULL,
  516.  
  517.     TROB_Space,               (ULONG) NULL,
  518.  
  519.     TRGR_Horiz,               (ULONG) TRGR_PROPSHARE|TRGR_ALIGN|TRGR_CENTER,
  520.       TROB_Space,             (ULONG) NULL,
  521.       TROB_Button,            (ULONG) NULL, TRAT_Text, (ULONG) "_Button", TRAT_ID, 3, TRAT_Disabled, TRUE,
  522.       TROB_Space,             (ULONG) NULL,
  523.     TRGR_End,                 (ULONG) NULL,
  524.  
  525.     TROB_Space,               (ULONG) NULL,
  526.  
  527.   TRGR_End,                   (ULONG) NULL,
  528.  
  529.   TAG_END
  530. };
  531.  
  532.  
  533. VOID do_disabling(VOID)
  534. {
  535.   BOOL close_me=FALSE;
  536.   struct TR_Message *trmsg;
  537.   struct TR_Project *disabling_project;
  538.  
  539.   if(disabling_project=TR_OpenProject(Application,disabling_trwintags))
  540.   {
  541.     TR_LockProject(main_project);
  542.     while(!close_me)
  543.     {
  544.       TR_Wait(Application,NULL);
  545.       while(trmsg=TR_GetMsg(Application))
  546.       {
  547.         if(trmsg->trm_Project==disabling_project) switch(trmsg->trm_Class)
  548.         {
  549.           case TRMS_CLOSEWINDOW:
  550.             close_me=TRUE;
  551.             break;
  552.  
  553.           case TRMS_ERROR:
  554.             puts(TR_GetErrorString(trmsg->trm_Data));
  555.             break;
  556.  
  557.           case TRMS_NEWVALUE:
  558.             if(trmsg->trm_ID==1)
  559.             {
  560.               TR_SetAttribute(disabling_project,2,TRAT_Disabled,trmsg->trm_Data);
  561.               TR_SetAttribute(disabling_project,3,TRAT_Disabled,trmsg->trm_Data);
  562.             }
  563.         }
  564.         TR_ReplyMsg(trmsg);
  565.       }
  566.     }
  567.     TR_UnlockProject(main_project);
  568.     TR_CloseProject(disabling_project);
  569.   }
  570. }
  571.  
  572.  
  573. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  574. //////////////////////////////////////////////////////////////////////////////////////////// Window 'text' //
  575. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  576.  
  577. ProjectDefinition(text_trwintags)
  578. {
  579.   WindowID(5), WindowTitle("Text"), WindowPosition(TRWP_CENTERDISPLAY),
  580.   VertGroupA,
  581.     Space, CenteredText("Normal text"),
  582.     Space, CenteredTextH("Highlighted text"),
  583.     Space, CenteredText3("3-dimensional text"),
  584.     Space, CenteredTextB("Bold text"),
  585.     Space, CenteredText("A _shortcut"),
  586.     Space, CenteredInteger(42),
  587.     Space, EndGroup, EndProject
  588. };
  589.  
  590.  
  591. VOID do_text(VOID)
  592. {
  593.   BOOL close_me=FALSE;
  594.   struct TR_Message *trmsg;
  595.   struct TR_Project *text_project;
  596.  
  597.   if(text_project=TR_OpenProject(Application,text_trwintags))
  598.   {
  599.     TR_LockProject(main_project);
  600.     while(!close_me)
  601.     {
  602.       TR_Wait(Application,NULL);
  603.       while(trmsg=TR_GetMsg(Application))
  604.       {
  605.         if(trmsg->trm_Project==text_project) switch(trmsg->trm_Class)
  606.         {
  607.           case TRMS_CLOSEWINDOW:
  608.             close_me=TRUE;
  609.             break;
  610.  
  611.           case TRMS_ERROR:
  612.             puts(TR_GetErrorString(trmsg->trm_Data));
  613.             break;
  614.         }
  615.         TR_ReplyMsg(trmsg);
  616.       }
  617.     }
  618.     TR_UnlockProject(main_project);
  619.     TR_CloseProject(text_project);
  620.   }
  621. }
  622.  
  623.  
  624. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  625. ///////////////////////////////////////////////////////////////////////////////////// Window 'connections' //
  626. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  627.  
  628. ProjectDefinition(connections_trwintags)
  629. {
  630.   WindowID(6), WindowTitle("Connections"), WindowPosition(TRWP_CENTERDISPLAY),
  631.   VertGroupA,
  632.     Space,
  633.     NamedSeparatorI("_Checkmarks",1),
  634.     Space,
  635.  
  636.     HorizGroupSAC,
  637.       Space, CheckBox(1),
  638.       Space, CheckBox(1),
  639.       Space, CheckBox(1),
  640.       Space, EndGroup,
  641.  
  642.     Space,
  643.  
  644.     HorizGroupSAC,
  645.       Space, CheckBox(1),
  646.       Space, CheckBox(1),
  647.       Space, CheckBox(1),
  648.       Space, EndGroup,
  649.  
  650.     Space,
  651.     HorizGroupSAC,
  652.       Space, CheckBox(1),
  653.       Space, CheckBox(1),
  654.       Space, CheckBox(1),
  655.       Space, EndGroup,
  656.  
  657.     Space,
  658.     NamedSeparatorI("_Slider and Progress indicator",2),
  659.     Space,
  660.  
  661.     HorizGroupAC,
  662.       Space,
  663.       SliderGadget(0,10,8,2),
  664.       Space,
  665.       Integer3(8),TRAT_ID,2,TRAT_MinWidth,3,
  666.       Space,
  667.       EndGroup,
  668.  
  669.     Space,
  670.  
  671.     HorizGroupAC,
  672.       Space,
  673.       TextN("0%"),
  674.       Space,
  675.       Progress(10,8,2),
  676.       Space,
  677.       TextN("100%"),
  678.       Space,
  679.       EndGroup,
  680.  
  681.     Space,
  682.   EndGroup, EndProject
  683. };
  684.  
  685.  
  686. VOID do_connections(VOID)
  687. {
  688.   BOOL close_me=FALSE;
  689.   struct TR_Message *trmsg;
  690.   struct TR_Project *connections_project;
  691.  
  692.   if(connections_project=TR_OpenProject(Application,connections_trwintags))
  693.   {
  694.     TR_LockProject(main_project);
  695.     while(!close_me)
  696.     {
  697.       TR_Wait(Application,NULL);
  698.       while(trmsg=TR_GetMsg(Application))
  699.       {
  700.         if(trmsg->trm_Project==connections_project) switch(trmsg->trm_Class)
  701.         {
  702.           case TRMS_CLOSEWINDOW:
  703.             close_me=TRUE;
  704.             break;
  705.  
  706.           case TRMS_ERROR:
  707.             puts(TR_GetErrorString(trmsg->trm_Data));
  708.             break;
  709.         }
  710.         TR_ReplyMsg(trmsg);
  711.       }
  712.     }
  713.     TR_UnlockProject(main_project);
  714.     TR_CloseProject(connections_project);
  715.   }
  716. }
  717.  
  718.  
  719. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  720. //////////////////////////////////////////////////////////////////////////////////////// Window 'backfill' //
  721. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  722.  
  723. ProjectDefinition(backfill_trwintags)
  724. {
  725.   WindowID(7), WindowTitle("Backfill"), WindowPosition(TRWP_CENTERDISPLAY),
  726.   VertGroupA,
  727.     Space,  CenteredText("Each window and"),
  728.     SpaceS, CenteredText("FrameBox can have"),
  729.     SpaceS, CenteredText("one of the following"),
  730.     SpaceS, CenteredText("backfill patterns"),
  731.     Space,  HorizGroupA,
  732.               Space, FrameBox, ObjectBackfillS, SpaceB,
  733.               Space, FrameBox, ObjectBackfillSA, SpaceB,
  734.               Space, FrameBox, ObjectBackfillSF, SpaceB,
  735.               Space, EndGroup,
  736.     Space,  HorizGroupA,
  737.               Space, FrameBox, ObjectBackfillSB, SpaceB,
  738.               Space, FrameBox, ObjectBackfillA, SpaceB,
  739.               Space, FrameBox, ObjectBackfillAF, SpaceB,
  740.               Space, EndGroup,
  741.     Space,  HorizGroupA,
  742.               Space, FrameBox, ObjectBackfillAB, SpaceB,
  743.               Space, FrameBox, ObjectBackfillF, SpaceB,
  744.               Space, FrameBox, ObjectBackfillFB, SpaceB,
  745.               Space, EndGroup,
  746.     Space, EndGroup, EndProject
  747. };
  748.  
  749.  
  750. VOID do_backfill(VOID)
  751. {
  752.   BOOL close_me=FALSE;
  753.   struct TR_Message *trmsg;
  754.   struct TR_Project *backfill_project;
  755.  
  756.   if(backfill_project=TR_OpenProject(Application,backfill_trwintags))
  757.   {
  758.     TR_LockProject(main_project);
  759.     while(!close_me)
  760.     {
  761.       TR_Wait(Application,NULL);
  762.       while(trmsg=TR_GetMsg(Application))
  763.       {
  764.         if(trmsg->trm_Project==backfill_project) switch(trmsg->trm_Class)
  765.         {
  766.           case TRMS_CLOSEWINDOW:
  767.             close_me=TRUE;
  768.             break;
  769.  
  770.           case TRMS_ERROR:
  771.             puts(TR_GetErrorString(trmsg->trm_Data));
  772.             break;
  773.         }
  774.         TR_ReplyMsg(trmsg);
  775.       }
  776.     }
  777.     TR_UnlockProject(main_project);
  778.     TR_CloseProject(backfill_project);
  779.   }
  780. }
  781.  
  782.  
  783. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  784. /////////////////////////////////////////////////////////////////////////////////////// Window 'appwindow' //
  785. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  786.  
  787. ProjectDefinition(appwindow_trwintags)
  788. {
  789.   WindowID(8), WindowTitle("AppWindow"), WindowPosition(TRWP_CENTERDISPLAY), WindowBackfillFB,
  790.   VertGroupA,
  791.     Space,  CenteredText("This window is an application window."),
  792.     SpaceS, CenteredText("Drop icons into the window or into"),
  793.     SpaceS, CenteredText("the icon drop boxes below and see"),
  794.     SpaceS, CenteredText("what will happen..."),
  795.     Space,  HorizGroupA,
  796.               Space, DropBox(1),
  797.               Space, DropBox(2),
  798.               Space, EndGroup,
  799.     Space, EndGroup, EndProject
  800. };
  801.  
  802.  
  803. VOID do_appwindow(VOID)
  804. {
  805.   BOOL close_me=FALSE;
  806.   struct TR_Message *trmsg;
  807.   struct TR_Project *appwindow_project;
  808.   UBYTE reqstr[200],dirname[100];
  809.  
  810.   if(appwindow_project=TR_OpenProject(Application,appwindow_trwintags))
  811.   {
  812.     TR_LockProject(main_project);
  813.     while(!close_me)
  814.     {
  815.       TR_Wait(Application,NULL);
  816.       while(trmsg=TR_GetMsg(Application))
  817.       {
  818.         if(trmsg->trm_Project==appwindow_project) switch(trmsg->trm_Class)
  819.         {
  820.           case TRMS_CLOSEWINDOW:
  821.             close_me=TRUE;
  822.             break;
  823.  
  824.           case TRMS_ERROR:
  825.             puts(TR_GetErrorString(trmsg->trm_Data));
  826.             break;
  827.  
  828.           case TRMS_ICONDROPPED:
  829.             dirname[0]=0;
  830.             NameFromLock(((struct AppMessage *)(trmsg->trm_Data))->am_ArgList->wa_Lock,dirname,100);
  831.             AddPart(dirname,((struct AppMessage *)(trmsg->trm_Data))->am_ArgList->wa_Name,100);
  832.             switch(trmsg->trm_ID)
  833.             {
  834.               case 1:
  835.                 sprintf(reqstr,"Icon(s) dropped into the left box.\tName of first dropped icon:\n%%3%s",dirname);
  836.                 break;
  837.               case 2:
  838.                 sprintf(reqstr,"Icon(s) dropped into the right box.\tName of first dropped icon:\n%%3%s",dirname);
  839.                 break;
  840.               default:
  841.                 sprintf(reqstr,"Icon(s) dropped into the window.\tName of first dropped icon:\n%%3%s",dirname);
  842.             }
  843.             TR_EasyRequestTags(Application,reqstr,"_Ok",
  844.               TREZ_LockProject,appwindow_project,TREZ_Title,"AppWindow report",TREZ_Activate,TRUE,TAG_END);
  845.             break;
  846.         }
  847.         TR_ReplyMsg(trmsg);
  848.       }
  849.     }
  850.     TR_UnlockProject(main_project);
  851.     TR_CloseProject(appwindow_project);
  852.   }
  853. }
  854.  
  855.  
  856. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  857. /////////////////////////////////////////////////////////////////////////////////////////// Window 'lists' //
  858. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  859.  
  860. struct TR_Dimensions lists_dim;
  861.  
  862. extern struct MinList LVList1;
  863. extern struct MinList LVList2;
  864. extern struct MinList LVList3;
  865.  
  866. struct Node LVNodes1[] =
  867. {
  868.   { &LVNodes1[1], (struct Node *)&LVList3.mlh_Head, 0, 0, "This is a" },
  869.   { &LVNodes1[2], &LVNodes1[0],                     0, 0, "READ" },
  870.   { &LVNodes1[3], &LVNodes1[1],                     0, 0, "ONLY" },
  871.   { &LVNodes1[4], &LVNodes1[2],                     0, 0, "Listview" },
  872.   { &LVNodes1[5], &LVNodes1[3],                     0, 0, "gadget" },
  873.   { &LVNodes1[6], &LVNodes1[4],                     0, 0, "using the" },
  874.   { &LVNodes1[7], &LVNodes1[5],                     0, 0, "fixed-width" },
  875.   { &LVNodes1[ 8], &LVNodes1[ 6],                   0, 0, "font." },
  876.   { &LVNodes1[ 9], &LVNodes1[ 7],                   0, 0, "" },
  877.   { &LVNodes1[10], &LVNodes1[ 8],                   0, 0, "This window" },
  878.   { &LVNodes1[11], &LVNodes1[ 9],                   0, 0, "uses a" },
  879.   { &LVNodes1[12], &LVNodes1[10],                   0, 0, "dimensions" },
  880.   { &LVNodes1[13], &LVNodes1[11],                   0, 0, "structure," },
  881.   { &LVNodes1[14], &LVNodes1[12],                   0, 0, "so it will" },
  882.   { &LVNodes1[15], &LVNodes1[13],                   0, 0, "remember" },
  883.   { &LVNodes1[16], &LVNodes1[14],                   0, 0, "its" },
  884.   { &LVNodes1[17], &LVNodes1[15],                   0, 0, "position" },
  885.   { &LVNodes1[18], &LVNodes1[16],                   0, 0, "when you" },
  886.   { (struct Node *)&LVList3.mlh_Tail, &LVNodes1[17],0, 0, "reopen it." }
  887. };
  888.  
  889. struct Node LVNodes2[] =
  890. {
  891.   { &LVNodes2[1], (struct Node *)&LVList3.mlh_Head, 0, 0, "This is a" },
  892.   { &LVNodes2[2], &LVNodes2[0],                     0, 0, "SELECT" },
  893.   { &LVNodes2[3], &LVNodes2[1],                     0, 0, "Listview" },
  894.   { &LVNodes2[4], &LVNodes2[2],                     0, 0, "gadget." },
  895.   { &LVNodes2[5], &LVNodes2[3],                     0, 0, "Use the" },
  896.   { &LVNodes2[6], &LVNodes2[4],                     0, 0, "numeric" },
  897.   { &LVNodes2[7], &LVNodes2[5],                     0, 0, "key pad to" },
  898.   { &LVNodes2[8], &LVNodes2[6],                     0, 0, "move" },
  899.   { (struct Node *)&LVList3.mlh_Tail, &LVNodes2[7], 0, 0, "around." }
  900. };
  901.  
  902. struct Node LVNodes3[] =
  903. {
  904.   { &LVNodes3[1], (struct Node *)&LVList3.mlh_Head, 0, 0, "This is a" },
  905.   { &LVNodes3[2], &LVNodes3[0],                     0, 0, "SHOW" },
  906.   { &LVNodes3[3], &LVNodes3[1],                     0, 0, "SELECTED" },
  907.   { &LVNodes3[4], &LVNodes3[2],                     0, 0, "Listview" },
  908.   { &LVNodes3[5], &LVNodes3[3],                     0, 0, "gadget." },
  909.   { &LVNodes3[6], &LVNodes3[4],                     0, 0, "This list" },
  910.   { &LVNodes3[7], &LVNodes3[5],                     0, 0, "is a bit" },
  911.   { &LVNodes3[8], &LVNodes3[6],                     0, 0, "longer, so" },
  912.   { &LVNodes3[9], &LVNodes3[7],                     0, 0, "that you" },
  913.   { &LVNodes3[10],&LVNodes3[8],                     0, 0, "can try the" },
  914.   { &LVNodes3[11],&LVNodes3[9],                     0, 0, "other" },
  915.   { &LVNodes3[12],&LVNodes3[10],                    0, 0, "keyboard" },
  916.   { (struct Node *)&LVList3.mlh_Tail, &LVNodes3[11],0, 0, "shortcuts." }
  917. };
  918.  
  919. struct List LVList1=
  920. {
  921.   (struct Node *)&LVNodes1[0],
  922.   (struct Node *)NULL,
  923.   (struct Node *)&LVNodes1[18],
  924.   0,0
  925. };
  926.  
  927. struct List LVList2=
  928. {
  929.   (struct Node *)&LVNodes2[0],
  930.   (struct Node *)NULL,
  931.   (struct Node *)&LVNodes2[8],
  932.   0,0
  933. };
  934.  
  935. struct List LVList3=
  936. {
  937.   (struct Node *)&LVNodes3[0],
  938.   (struct Node *)NULL,
  939.   (struct Node *)&LVNodes3[12],
  940.   0,0
  941. };
  942.  
  943.  
  944. struct TagItem lists_trwintags[]=
  945. {
  946.   WindowID(9), WindowTitle("Lists"), WindowPosition(TRWP_CENTERDISPLAY), WindowDimensions(&lists_dim),
  947.   VertGroupEA,
  948.     Space,
  949.  
  950.     NamedSeparatorI("_Read only",1),
  951.     Space,
  952.     HorizGroupA,
  953.       Space,
  954.       FWListROCN(&LVList1,1,0),
  955.       Space,
  956.     EndGroup,
  957.     Space,
  958.  
  959.     NamedSeparatorI("_Select",2),
  960.     Space,
  961.     HorizGroupA,
  962.       Space,
  963.       ListSelC(&LVList2,2,0),
  964.       Space,
  965.     EndGroup,
  966.     Space,
  967.  
  968.     NamedSeparatorI("S_how selected",3),
  969.     Space,
  970.     HorizGroupA,
  971.       Space,
  972.       ListSSN(&LVList3,3,0,1),
  973.       Space,
  974.     EndGroup,
  975.     Space,
  976.  
  977.   EndGroup,
  978.   EndProject
  979. };
  980.  
  981.  
  982. VOID do_lists(VOID)
  983. {
  984.   BOOL close_me=FALSE;
  985.   struct TR_Message *trmsg;
  986.   struct TR_Project *lists_project;
  987.  
  988.   if(lists_project=TR_OpenProject(Application,lists_trwintags))
  989.   {
  990.     TR_LockProject(main_project);
  991.     while(!close_me)
  992.     {
  993.       TR_Wait(Application,NULL);
  994.       while(trmsg=TR_GetMsg(Application))
  995.       {
  996.         if(trmsg->trm_Project==lists_project) switch(trmsg->trm_Class)
  997.         {
  998.           case TRMS_CLOSEWINDOW:
  999.             close_me=TRUE;
  1000.             break;
  1001.  
  1002.           case TRMS_ERROR:
  1003.             puts(TR_GetErrorString(trmsg->trm_Data));
  1004.             break;
  1005.         }
  1006.         TR_ReplyMsg(trmsg);
  1007.       }
  1008.     }
  1009.     TR_UnlockProject(main_project);
  1010.     TR_CloseProject(lists_project);
  1011.   }
  1012. }
  1013.  
  1014.  
  1015. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1016. /////////////////////////////////////////////////////////////////////////////////////////// Window 'about' //
  1017. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1018.  
  1019. // Note: This could be done even simpler with TR_EasyRequest().
  1020. // ~~~~~ It is done with TR_AutoRequest() to show you how this works.
  1021. //       See window 'AppWindow' for a TR_EasyRequest() example.
  1022.  
  1023. ProjectDefinition(about_trwintags)
  1024. {
  1025.   BeginRequester("About...",TRWP_CENTERDISPLAY),
  1026.  
  1027.   VertGroupA, Space,  CenteredText3("Triton Demo"),
  1028.               SpaceS, CenteredText("© 1993-1994 by Stefan Zeiger"),
  1029.               Space,  HorizSeparator,
  1030.               Space,  CenteredText("This program is using the"),
  1031.               SpaceS, CenteredText("Triton GUI creation system"),
  1032.               SpaceS, CenteredText("which is © by Stefan Zeiger"),
  1033.               Space,  EndGroup,
  1034.  
  1035.   BeginRequesterGads,
  1036.   CenteredButtonRE("_Ok",1),
  1037.   EndRequester
  1038. };
  1039.  
  1040.  
  1041. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1042. //////////////////////////////////////////////////////////////////////////////////////////// Window 'main' //
  1043. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1044.  
  1045. ProjectDefinition(main_trwintags)
  1046. {
  1047.   WindowID(10), WindowTitle("Triton Demo"), WindowBackfillFB, WindowPosition(TRWP_CENTERDISPLAY),
  1048.   BeginMenu("Project"),
  1049.     MenuItem("?_About...",101),
  1050.     ItemBarlabel,
  1051.     MenuItem("Q_Quit",102),
  1052.   VertGroupA,
  1053.     Space,  CenteredText3("T · r · i · t · o · n"),
  1054.     Space,  CenteredText3("The object oriented GUI creation system"),
  1055.     Space,  CenteredText("Demo program"),
  1056.     Space,  CenteredText("Written and © 1993-1994 by Stefan Zeiger"),
  1057.     Space,  HorizSeparator,
  1058.     Space,  HorizGroupEA,
  1059.               Space, Button("_Gadgets",1),
  1060.               Space, Button("G_roups",2),
  1061.               Space, Button("_Text",3),
  1062.               Space, EndGroup,
  1063.     Space, HorizGroupEA,
  1064.               Space, Button("_Connections",4),
  1065.               Space, Button("_Backfill",5),
  1066.               Space, Button("_Disabling",6),
  1067.               Space, EndGroup,
  1068.     Space, HorizGroupEA,
  1069.               Space, Button("_AppWindow",7),
  1070.               Space, Button("_Menus",8),
  1071.               Space, Button("_Lists",9),
  1072.               Space, EndGroup,
  1073.     Space, EndGroup, EndProject
  1074. };
  1075.  
  1076.  
  1077. VOID do_main(VOID)
  1078. {
  1079.   BOOL close_me=FALSE;
  1080.   struct TR_Message *trmsg;
  1081.  
  1082.   if(main_project=TR_OpenProject(Application,main_trwintags))
  1083.   {
  1084.     while(!close_me)
  1085.     {
  1086.       TR_Wait(Application,NULL);
  1087.       while(trmsg=TR_GetMsg(Application))
  1088.       {
  1089.         if(trmsg->trm_Project==main_project) switch(trmsg->trm_Class)
  1090.         {
  1091.           case TRMS_CLOSEWINDOW:
  1092.             close_me=TRUE;
  1093.             break;
  1094.  
  1095.           case TRMS_ERROR:
  1096.             puts(TR_GetErrorString(trmsg->trm_Data));
  1097.             break;
  1098.  
  1099.           case TRMS_ACTION:
  1100.             switch(trmsg->trm_ID)
  1101.             {
  1102.               case 1:
  1103.                 do_gadgets();
  1104.                 break;
  1105.               case 2:
  1106.                 do_groups();
  1107.                 break;
  1108.               case 3:
  1109.                 do_text();
  1110.                 break;
  1111.               case 4:
  1112.                 do_connections();
  1113.                 break;
  1114.               case 5:
  1115.                 do_backfill();
  1116.                 break;
  1117.               case 6:
  1118.                 do_disabling();
  1119.                 break;
  1120.               case 7:
  1121.                 do_appwindow();
  1122.                 break;
  1123.               case 8:
  1124.                 do_menus();
  1125.                 break;
  1126.               case 9:
  1127.                 do_lists();
  1128.                 break;
  1129.               case 101:
  1130.                 TR_AutoRequest(Application,main_project,about_trwintags);
  1131.                 break;
  1132.               case 102:
  1133.                 close_me=TRUE;
  1134.             }
  1135.             break;
  1136.         }
  1137.         TR_ReplyMsg(trmsg);
  1138.       }
  1139.     }
  1140.     TR_CloseProject(main_project);
  1141.   }
  1142. }
  1143.  
  1144.  
  1145. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1146. //////////////////////////////////////////////////////////////////////////////////////////// Main function //
  1147. /////////////////////////////////////////////////////////////////////////////////////////////////////////////
  1148.  
  1149. int main(void)
  1150. {
  1151.   if(TR_OpenTriton(0,TRCA_Name,"TritonDemo",TRCA_LongName,"Triton demo",TRCA_Version,"1.0",TAG_END))
  1152.   {
  1153.     do_main();
  1154.     TR_CloseTriton();
  1155.     return 0;
  1156.   }
  1157.  
  1158.   puts("Can't open triton.library.");
  1159.   return 20;
  1160. }
  1161.